//
//  ToManyField
//
//  Created by Caue W. on 2011-03-28.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
package time.types.query;

//This is used only to provide autocompletion for the query macros
interface ToManyField<T> implements ArrayAccess<T>
{
	function get(n:Int) : T;
	
	//TODO: sort function: how to on various MapReduce libs
	//function sort(?byField:String) : ToManyField<T>;
	
	function sum(?acessor:T->X) : Float; 
	function avg(?acessor:T->X) : Float;
	
	function max<X>(?acessor:T->X) : X;
	function min<X>(?acessor:T->X) : X;
	
	function length() : Int;
	
	function first() : T;
	function last() : T;
	
	function sHas(obj:T) : Bool;
	function has(cond:T->Bool) : Bool;
	
	function filter(cond:T->Bool) : ToManyField<T>;
	
}